{categories}

<table class="home">

	<tr>
		<th class="cat_name" id="{id}">
			{name}
		</th>
		{cond:admin}
			<th class="delete">
				{anchor:'category/admin/delete/{id}', 'Delete', 'class="admin delete_confirm"'}
			</th>
		{/cond:admin}
	</tr>
	
	<tr><td colspan="2">
	
		<table border="0" class="single_category">
			<tr class="subheader">
				<td class="name">Forum</td>
				<td {cond:admin}colspan="2"{/cond:admin}>Latest Post</td>
			</tr>
			{forums}
				<? if ($forum == -1 ): ?>

					<tr class="single_forum">
						<td colspan="2" style="width: 50em; padding: 1em">
							There are no forums in this category.
						</td>
					</tr>
		
				<? else: ?>

					<tr class="single_forum">
						<td class="name">
							{anchor:'forum/view/{f_id}', '{f_name}'}
							<br/>
							<small class="forum_description" id="{f_id}">{f_description}</small>
						</td>
						<td class="latest" {not_admin}style="width: 27.5em"{/not_admin}>
							<? if($forum['newest_time'] != 0): ?>
								Last Post:<br/>
									<?= anchor('topic/view/'.$forum['newest_id'], mdate('%d %F %h:%i %A', gmt_to_local($forum['newest_time'], $this->_user['timezone'], $this->_user['daylight_savings'])) ) ?>
							<? else: ?>
								Forum is empty
							<? endif; ?>
						</td>
						{cond:admin}
						<td class="delete">{anchor:'forum/admin/delete/{f_id}/{id}', 'X', 'class = "admin delete_confirm"'}</td>
						{/cond:admin}
					</tr>

				<? endif; ?>
			{/forums}
		</table>

	</td></tr>

	{cond:admin}
	<tr><td colspan="2" class="add_forum">
		{anchor:'forum/admin/add/{id}', 'Add Forum', 'class = "admin"'}
	</td></tr>
	{/cond:admin}

</table>

{/categories}

{cond:admin}
	{anchor:'category/admin/add', 'Add a category', 'class = "admin"'}
{/cond:admin}

{cond:admin_box}
{/cond:admin_box}